home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 August / August CD.bin / Shareware / Education / numericalmethods Folder / chap_4 / zsqrt.m < prev    next >
Encoding:
Text File  |  1994-06-05  |  1.1 KB  |  53 lines  |  [MATF/MATL]

  1. function [fun,dfun,ifun,x0,m,C,Ax] = zsqrt
  2. % Taylor series coefficient lists for several functions.
  3. % Pm(x) = c(1) + c(2)x + c(2)x^2 + ... + c(m+1)x^m
  4. % fun  is the function, output.
  5. % dfun is the derivative, output.
  6. % ifun is the integral, output.
  7. % x0 is the point of expansion, output.
  8. % m  is the degree of the polynomial, output.
  9. % C  is the coefficient list, output.
  10. % Ax contains three asis vectors plotting, output.
  11. x0 = 0; 
  12. m = 25;
  13. a = -0.99;
  14. b = 1.0;
  15. ymin = 0;
  16. ymax = 1.5;
  17. ymin1 = 0;
  18. ymax1 = 2;
  19. ymin2 = -0.8;
  20. ymax2 = 1.3;
  21. Ax(1,:) = [a b ymin ymax];
  22. Ax(2,:) = [a b ymin1 ymax1];
  23. Ax(3,:) = [a b ymin2 ymax2];
  24. fun = 'sqrt(1+x)';
  25. dfun = '(2.*sqrt(1+x)).^(-1)';
  26. ifun = '(2/3 + 2*x/3).*sqrt(1+x)-2/3';
  27. C = [322476036831/140737488355328,
  28. -171529806825/70368744177664,
  29. 11435320455/4398046511104,
  30. -6116566755/2199023255552,
  31. 1641030105/549755813888,
  32. -883631595/274877906944,
  33. 119409675/34359738368,
  34. -64822395/17179869184,
  35. 17678835/4294967296,
  36. -9694845/2147483648,
  37. 334305/67108864,
  38. -185725/33554432,
  39. 52003/8388608,
  40. -29393/4194304,
  41. 4199/524288,
  42. -2431/262144,
  43. 715/65536,
  44. -429/32768,
  45. 33/2048,
  46. -21/1024,
  47. 7/256,
  48. -5/128,
  49. 1/16,
  50. -1/8,
  51. 1/2,
  52. 1];
  53.